main: add support for CLI extensions via external binaries
authorLuca BRUNO <luca.bruno@coreos.com>
Mon, 20 Dec 2021 10:00:02 +0000 (10:00 +0000)
committerLuca BRUNO <luca.bruno@coreos.com>
Mon, 20 Dec 2021 10:00:02 +0000 (10:00 +0000)
commit513b3c09a54af31ffd1b0eb9b3c47849816483be
treed8fc230e2dd16fb0e88f0d4789f951a74a9cd234
parent365559eaa8126d60366b3f69585268dd89ce3a3a
main: add support for CLI extensions via external binaries

This adds some logic to detect and dispatch unknown subcommands to
extensions available in `$PATH`. Additional commands can be
implemented by adding relevant `ostree-$verb` binaries to the system.

As an example, if a `/usr/bin/ostree-extcommand` extension is provided,
the execution of `ostree extcommand --help` will be dispatched to that
as `ostree-extcommand extcommand --help`.
Makefile-tests.am
src/ostree/main.c
src/ostree/ot-main.c
src/ostree/ot-main.h
tests/test-cli-extensions.sh [new file with mode: 0755]